pp108 : String Functions

String Functions

This topic describes the various string functions available in the default Process Platform XSLT function library.


String functions can be used to manipulate string values. You can concatenate output values to a target, change the capitalization of strings, extract substrings, replace strings with new values, and remove leading spaces. Refer to Transforming Data using XSLT Functions, for more information on the procedure to transform the data using XSLT functions.
The various string functions supported by Cordys, their functionality, and parameters that have to be specified are described in the following table:
Table 1. String Functions

String Function

Description

Parameters

Concat

Concats two or more string values

Initial String - The string that is to be concatenated. String to Concat - The string that concats to the initial string.
Note: One or more parameters of any data type can be specified for this function.

Lower Case

Converts all alphabetic characters to lower case

String - The string to be converted to lower case.

Upper Case

Converts all alphabetic characters to upper case

String - The string to be converted to upper case.

Replace

Replaces the source string character by character

This function consists of the following parameters:

1. String - This parameter specifies the source string on which this function will be applied.
2. Character to be Replaced - This parameter specifies the character in the source string to be replaced.
3. Character to Replace - This parameter specifies the character to replace the character specified in the second parameter.For example: replace("Joanne", "n", "l") will return Joalle

Substring

return s string of a specified length starting from a specified location. Index of the first character is

1. If length is omitted it return s the substring from the start position to the end

This function consists of the following parameters:

1. String - This parameter specifies the source string from where the substring is to be extracted.
2. Start Position of Substring - This parameter specifies the starting position of the substring that is to be extracted, from the string.
3. Length of Substring - This parameter specifies the length or number of characters to be extracted.For Example:

  • substring('Joanne',3,4) will return anne
  • substring(Joanne',2 ) will return oanne

Substring-Before

return s the substring before a specified character in the string

This function consists of the following parameters:

1. String - This parameter specifies the source string from where the substring is to be extracted.
2. Character Next to Substring - This parameter specifies the character next to the substring to be extracted. The function will extract the substring that is before the character specified in this parameter.For example:substring-before('1999/04/01','/')will return 1999.

Substring-After

return s the substring after a specified character in the string

This function consists of the following parameters:

1. String - This parameter specifies the source string from where the substring is to be extracted.
2. Character Next to Substring - This parameter specifies the string before the substring to be extracted.The function will extract the substring that is after the string specified in this parameter. For example:substring-after('1999/04/01','/')will return /04/01.

String Length

return s a number equal to the number of characters in a given string. If there is no string argument it return s the length of the string value of the current node

String - The string whose length is to be return ed.For example: string-length('Joanne') will return 7.

Trim

Trims leading and trailing whitespaces and replaces the sequences of whitespace characters within the string by a single space.

String - The string for which the leading and trailing spaces have to be trimmed.For example: trim(' Joanne ') will return Joanne